﻿Imports System.Data
Imports System.Data.SqlClient
Public Class LoaiTaiKhoanDAO
    Shared Function loadLoaiTK() As DataTable
        Dim sql As String = "select * from LOAITAIKHOAN"
        Dim dt As New DataTable
        dt = DataProvider.DataTable(sql)
        Return dt
    End Function

    Shared Function returnLTK(ByVal ltk As LoaiTaiKhoanDTO) As String
        Dim cn As New SqlConnection
        cn = DataProvider.CreaConnection()
        Dim cmd As New SqlCommand("sp_tenLTK", cn)
        cmd.CommandType = CommandType.StoredProcedure

        Dim input As New SqlParameter("@maLoaiTK", SqlDbType.Int)
        Dim output As New SqlParameter("@tenLoai", SqlDbType.Char)

        output.Size = 30
        input.Value = ltk.maLoai
        output.Direction = ParameterDirection.Output

        cmd.Parameters.Add(input)
        cmd.Parameters.Add(output)

        cmd.ExecuteNonQuery()
        Dim str As String
        str = Convert.ToString(output.Value)
        cn.Close()
        Return str
    End Function
End Class
